<?php

namespace App\Modules\Admin\Entities\Property;

use App\Models\Model;

class CheckItemModel extends Model
{

    protected $primaryKey='item_id';
    protected $table='check_item';

    public function category_info(){
        return $this->hasOne(CheckCategoryModel::class,'category_id','category_id')->select(['category_id','category_name']);
    }
    public function category()
    {
        return $this->belongsTo(CheckCategoryModel::class, 'category_id');
    }
    public function latestRecord()
    {
        return $this->hasOne(MaintenanceRecordModel::class)
            ->latestOfMany();
    }

}
